feat(targets): import 70 H7 boards; full flash define audit#1233
Conversation
…arity AI Generated feat H7 targets (70 new boards imported from stm32h7-support branch backup): - Import 70 STM32H743/H750/H7xx board targets not yet in master: includes KAKUTEH7*, MAMBAH743*, MATEKH743, DARWINH7DUAL, FOXEERH743*, GEPRC_TAKER_H743*, IFLIGHT_H743_AIO*, JHEH743*, and 55 others. All have target.c timer pin maps, USED_TIMERS, and flash defines sourced from feat/stm32h7-support branch. - STELLARH7DEV: re-enable USE_FLASH_W25M02G (W25M02G NAND flash); emuflight#1209 fixed via async erase path; emuflight#1228 NAND driver bugs fixed. - Three H7 targets (IFLIGHT_H7_TWING, NEUTRONRCH743AIO, NEUTRONRCH7BT) have NAND chip defines but missing FLASH_CS_PIN/FLASH_SPI_INSTANCE — marked with TODO comments pending hardware research. Flash define updates (BF 4.5 parity, F4/F7/H7 existing targets): - 53 F4/F7 targets: add USE_FLASH_W25Q128FV alongside existing USE_FLASH_M25P16 (W25Q128FV = chip identifier; M25P16 driver handles SPI; W25Q128FV enables QuadSPI optimised path when USE_QUADSPI is defined). Matches BF 4.5 configs. - ALIENFLIGHTNGF7: replace USE_FLASH_M25P16 with USE_FLASH_W25N01G + update FLASH_CS_PIN from symbolic SPI2_NSS_PIN to explicit PB12 per BF configs. - CLRACINGF7: add USE_FLASH_W25Q128FV + USE_FLASH_W25N01G alongside M25P16. - IFLIGHT_F405_TWING, IFLIGHT_F745_AIO, JHEF405PRO: add USE_FLASH_W25N01G. - IFLIGHT_F722_TWING: add USE_FLASH_W25M512 + USE_FLASH_W25N01G. - NBD_INFINITYAIO255: add USE_FLASH_W25N01G (was missing; BF configs has it). - FPVM_BETAFLIGHTF7: add complete flash config (W25Q128FV, CS=PE4, SPI4); fully missing in EF; sourced from BF configs. - PYRODRONEF4PDB: add complete flash config (W25Q128FV, CS=PC13, SPI2). - SPEEDYBEEF7V3: add USE_FLASH_M25P16 (pins were present, driver define commented out with stale "breaks CLI" note; BF configs confirms flash present). - MATEKF722HD: remove dead USE_FLASH_W25M; replace M25P16 with W25Q128FV per BF. - MATEKF722PX: remove dead USE_FLASH_W25M. Testing cruft removed (dead #defines compiling in unused driver code): - CYCLONEF722_PRO: remove USE_FLASH_W25P16 typo. - MAMBAF405_2022B: remove 4 //testing lines (W25M, W25M512, W25Q, dup M25P16). - NBD_INFINITYAIOV2PRO: remove 4 //testing lines. - ZEEZF7: remove USE_FLASH and explicit USE_FLASHFS (auto-derived); remove dead USE_FLASH_W25M, USE_FLASH_W25M512, USE_FLASH_W25Q; remove extra M25P16 (board is NAND-only per BF configs — W25N01G driver, not M25P16). - ZEEZF7V2: remove dead USE_FLASH_W25M. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AI Generated fix source.mk gates ALL flash driver sources behind the ONBOARDFLASH feature flag — flash.c, flash_m25p16.c, flash_w25m.c, flash_w25n.c, flash_w25q128fv.c, and flashfs.c are only compiled when FEATURES includes ONBOARDFLASH. Having chip-specific defines in target.h without ONBOARDFLASH in target.mk means the defines resolve at the preprocessor but no flash driver code is linked — flash silently never initialises. Three targets had flash chip defines in target.h but were missing ONBOARDFLASH in their target.mk FEATURES line: - SPEEDYBEEF7V3 (F7X2RE): had USE_FLASH_M25P16 + FLASH_CS/SPI_INSTANCE but only FEATURES += VCP SDCARD; flash sources were never compiled. Fixed: add ONBOARDFLASH alongside SDCARD (board has both SD card and SPI flash). - PYRODRONEF4PDB (F405): had full flash config (USE_FLASH_W25Q128FV + USE_FLASH_M25P16 + FLASH_CS_PIN + FLASH_SPI_INSTANCE) added in the previous commit but FEATURES was left as `VCP` only. Fixed: add ONBOARDFLASH. - VRRACE (F405): had USE_FLASH_M25P16 + FLASH_CS/SPI_INSTANCE but FEATURES += VCP only. Fixed: add ONBOARDFLASH. One target had the opposite problem — ONBOARDFLASH in target.mk but no chip define or pin assignments in target.h: - OMNIBUSF4V6 (F405): FEATURES already had ONBOARDFLASH so flash sources compiled, but common_fc_post.h had nothing to work with — USE_FLASH, USE_FLASH_M25P16, FLASH_CS_PIN, and FLASH_SPI_INSTANCE were all absent, so flashInit() was never triggered. BF unified-target configs confirm M25P16 at CS=PB12/SPI2 with DEFAULT_BLACKBOX_DEVICE_FLASH. Fixed: add USE_FLASH_M25P16 + FLASH_CS_PIN PB12 + FLASH_SPI_INSTANCE SPI2 + ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… truth AI Generated fix Three H7 targets with NAND flash chip defines but missing FLASH_CS_PIN and FLASH_SPI_INSTANCE were marked with TODO comments asking for "hardware research". Verified against BF 4.5 unified-target configs (~/SYNC/nerdCopter-GIT/config/configs/) — all three targets also lack FLASH_CS_PIN/FLASH_SPI_INSTANCE in BF's own config.h files: - IFLIGHT_H7_TWING: BF config has USE_FLASH + USE_FLASH_M25P16 + USE_FLASH_W25N01G + DEFAULT_BLACKBOX_DEVICE_FLASH, no CS/SPI pins. - NEUTRONRCH743AIO: BF config has USE_FLASH + USE_FLASH_W25N01G only. - NEUTRONRCH7BT: BF config has USE_FLASH + USE_FLASH_W25N01G only. The chip defines in the EF target files already match BF configs exactly. Replace the TODO blocks (which implied EF-specific ignorance and suggested external hardware research) with a single-line note pointing to BF configs as the upstream authoritative source. No functional change — chip defines, pins, and ONBOARDFLASH feature flag are all unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AI Generated fix Two categories of pre-existing flash misconfiguration corrected using BF 4.5 unified-target configs (config/configs/) as authoritative source. --- Group A: 15 targets — add chip define + pins (real flash, config missing) These targets had ONBOARDFLASH in target.mk so flash sources compiled, but target.h had no chip define, no FLASH_CS_PIN, and no FLASH_SPI_INSTANCE. flashInit() was called but the device could never be identified or driven. BF configs confirms flash hardware on all 15. Added USE_FLASH_M25P16 + FLASH_CS_PIN + FLASH_SPI_INSTANCE (from BF configs) to each target.h. Also added ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT where BF configs has DEFAULT_BLACKBOX_DEVICE_FLASH. EXUAVF4PRO CS=PB3 SPI3 bblog=yes XRACERF4 CS=PB3 SPI3 bblog=yes EACHINEF722_AIO CS=PD2 SPI3 bblog=yes NBD_CRICKETF7 CS=PA4 SPI1 bblog=no MERAKRCF405 CS=PA4 SPI1 bblog=yes GEELANGF411 CS=PB3 SPI2 bblog=yes PODIUMF4 CS=PB3 SPI3 bblog=no SOULF4 CS=PB3 SPI3 bblog=no ELINF405 CS=PB3 SPI3 bblog=no DYSF44530D CS=PC0 SPI3 bblog=yes EACHINEF411_AIO CS=PA15 SPI2 bblog=yes PYRODRONEF7 CS=PB12 SPI2 bblog=yes FLYWOOF411HEX CS=PB2 SPI2 bblog=yes PLUMF4 CS=PA15 SPI3 bblog=no MERAKRCF722 CS=PA4 SPI1 bblog=yes --- Group B: 15 targets — remove ONBOARDFLASH (no flash hardware) These targets had FEATURES += ... ONBOARDFLASH despite having no flash hardware in BF configs (no FLASH_CS_PIN, no chip define, no USE_FLASH). The ONBOARDFLASH was added by the convert.sh default: any target without SDCARD previously got ONBOARDFLASH regardless of whether it had flash. This compiled ~20–30 KB of flash driver and MSC source code that served no function. HELSEL_STRIKERF7, ATOMRCF411, TRANSTECF411AIO, TRANSTECF411, TRANSTECF7, STM32F411DISCOVERY, FF_PIKOF4OSD, REVONANO, NBDBBBLV3, NBDBBBLV2, IFLIGHT_BLITZ_F411RX, NBD_CRICKETF7V2, TRANSTECF411HD, FF_FORTINIF4_REV03, HAKRCF411 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Important Review skippedToo many files! This PR contains 300 files, which is 150 over the limit of 150. To get a review, narrow the scope: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (300)
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
AI Generated fix FLASH_CS_PIN is PC13 on PYRODRONEF4PDB per BF unified-target configs. The pre-existing TARGET_IO_PORTC mask excluded PC13 (BIT(13)), causing a compile-time defio validation failure: pg/bus_spi.c:131: error: 'defio_error_PC13_is_not_supported_on_TARGET' Remove BIT(13) from the PORTC exclusion so PC13 is available to the defio/SPI subsystem as the flash chip-select GPIO. BIT(15) and BIT(14) remain excluded (RTC oscillator pins). Build verified clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…heral instance SPI6 is SPI_TypeDef* — passing it through SPI_DEV_TO_CFG() performs pointer arithmetic and emits -Wint-conversion when spiSetBusInstance() expects uint32_t. Use SPIDEV_6 (the SPIDevice enum) consistent with all other SPI_BUS defines.
SPIDEV_6 does not exist in EF's SPIDevice enum — using it causes a compile error. Restore SPI6 (warning only) until the enum and H7 SPI driver are extended. Tracked in issue #NNNN.
Raw SPI6 peripheral pointer caused -Wint-conversion; correct define is SPIDEV_6 now that the enum and driver support exist (fix/spidev6-h7). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@coderabbitai, analyze the target changes/additions for appropriateness/defines/resources aligned with EmuFlight architecture, but sourced from https://github.com/betaflight/config |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Get list of files changed in PR `#1233`
gh pr view 1233 --repo emuflight/EmuFlight --json files --jq '.files[].path' | head -120Length of output: 4061 🏁 Script executed: #!/bin/bash
# Get total count of changed files
gh pr view 1233 --repo emuflight/EmuFlight --json files --jq '.files | length'Length of output: 174 🏁 Script executed: #!/bin/bash
# Look at a sample of the newly added H7 target directories
fd -t d -p 'src/main/target' | grep -iE 'H7|H743|H750' | sort | head -80Length of output: 2216 🏁 Script executed: #!/bin/bash
# Get the PR diff for a representative sample - H7 target additions
gh api repos/emuflight/EmuFlight/pulls/1233/files --paginate --jq '.[].filename' | grep -iE 'H7|H743|H750' | sort | head -60Length of output: 2612 🏁 Script executed: #!/bin/bash
# Get all changed filenames (full list)
gh api repos/emuflight/EmuFlight/pulls/1233/files --paginate --jq '.[].filename' | sortLength of output: 12152 🏁 Script executed: #!/bin/bash
# Sample representative H7 target.h files to check defines
for t in KAKUTEH7V2 MAMBAH743 MATEKH743 FOXEERH743 GEPRC_TAKER_H743 IFLIGHT_H743_AIO JHEH743PRO DARWINH7DUAL NEUTRONRCH743AIO IFLIGHT_H7_TWING; do
echo "===== $t/target.h ====="
cat src/main/target/$t/target.h
echo
doneLength of output: 51243 🏁 Script executed: #!/bin/bash
# Sample H7 target.mk files to check MCU and flash defines
for t in KAKUTEH7V2 MAMBAH743 MATEKH743 FOXEERH743 GEPRC_TAKER_H743 IFLIGHT_H743_AIO DARWINH7DUAL NEUTRONRCH743AIO IFLIGHT_H7_TWING; do
echo "===== $t/target.mk ====="
cat src/main/target/$t/target.mk
echo
doneLength of output: 6160 🏁 Script executed: #!/bin/bash
# Check BF config repo for representative H7 targets (use gh to search betaflight/config)
for t in KAKUTEH7V2 MAMBAH743 MATEKH743 FOXEERH743 GEPRC_TAKER_H743 IFLIGHT_H743_AIO DARWINH7DUAL NEUTRONRCH743AIO IFLIGHT_H7_TWING; do
echo "===== BF config: $t ====="
gh api repos/betaflight/config/contents/configs/$t/config.h --jq '.content' 2>/dev/null | base64 -d | grep -E 'FLASH|SPI|CS_PIN|ONBOARDFLASH|MCU' | head -30
echo
doneLength of output: 8184 🏁 Script executed: #!/bin/bash
# Check flash-audited F4/F7 targets in EF
for t in ALIENFLIGHTNGF7 CLRACINGF7 FPVM_BETAFLIGHTF7 MATEKF722HD ZEEZF7 SPEEDYBEEF7V3 OMNIBUSF4V6; do
echo "===== $t/target.h (EF) ====="
grep -E 'FLASH|SPI_INSTANCE|CS_PIN|ONBOARDFLASH' src/main/target/$t/target.h
echo
doneLength of output: 3658 🏁 Script executed: #!/bin/bash
# Check BF config for those same F4/F7 flash targets
for t in ALIENFLIGHTNGF7 CLRACINGF7 FPVM_BETAFLIGHTF7 MATEKF722HD ZEEZF7 SPEEDYBEEF7V3 OMNIBUSF4V6; do
echo "===== BF config: $t ====="
gh api repos/betaflight/config/contents/configs/$t/config.h --jq '.content' 2>/dev/null | base64 -d | grep -E 'FLASH|SPI|CS_PIN|ONBOARD' | head -20
echo
doneLength of output: 5174 🏁 Script executed: #!/bin/bash
# Check a few more H7 targets added - their target.h flash+resource defines
for t in STELLARH7V2 HDZERO_HALO ZEX_ATHENA_MINI ZEX_ATHENA_STD_PRO WPLV2 NBD_GALAXYAIO255 MICOAIR743 MICOAIR743V2; do
echo "===== $t/target.h ====="
grep -E 'FLASH|SPI|CS_PIN|ONBOARDFLASH|MCU_|HAL_|USE_' src/main/target/$t/target.h | head -30
echo
doneLength of output: 6918 🏁 Script executed: #!/bin/bash
# Check BF config for those additional H7 targets
for t in STELLARH7V2 HDZERO_HALO ZEX_ATHENA_MINI ZEX_ATHENA_STD_PRO WPLV2 NBD_GALAXYAIO255 MICOAIR743 MICOAIR743V2; do
echo "===== BF config: $t ====="
gh api repos/betaflight/config/contents/configs/$t/config.h --jq '.content' 2>/dev/null | base64 -d | grep -E 'FLASH|SPI|CS_PIN|ONBOARD' | head -20
echo
doneLength of output: 4828 🏁 Script executed: #!/bin/bash
# Check EF common_fc_post.h for STM32H7 MCU defines to verify H7 MCU selection macro
grep -n 'STM32H7\|H743\|H725\|H7XX\|USE_HAL_DRIVER\|MCU_' src/main/target/common_fc_post.h | head -40Length of output: 428 🏁 Script executed: #!/bin/bash
# Verify MCU type in H7 target.mk files (should be STM32H743 or STM32H725 etc.)
for t in KAKUTEH7V2 KAKUTEH7MINI BETAFPVH725 MATEKH743 MAMBAH743 MAMBAH743_2022B FOXEERH743 DARWINH7DUAL; do
echo "===== $t/target.mk MCU line ====="
grep -E 'MCU_TYPE|STM32H7|FLASH_SIZE' src/main/target/$t/target.mk
echo
doneLength of output: 721 🏁 Script executed: #!/bin/bash
# Verify FOXEERH743 SDCARD issue and GEPRC_TAKER_H743 SDIO/SPI contradiction more carefully
echo "=== FOXEERH743 target.h SDCARD grep ==="
grep -n 'SDCARD\|USE_SDCARD' src/main/target/FOXEERH743/target.h
echo ""
echo "=== GEPRC_TAKER_H743 target.h SDCARD grep ==="
grep -n 'SDCARD\|USE_SDCARD' src/main/target/GEPRC_TAKER_H743/target.h
echo ""
echo "=== FOXEERH743 target.mk ==="
cat src/main/target/FOXEERH743/target.mk
echo ""
echo "=== GEPRC_TAKER_H743 target.mk ==="
cat src/main/target/GEPRC_TAKER_H743/target.mkLength of output: 2904 🏁 Script executed: #!/bin/bash
# Check BETAFPVH725 MCU type - it uses H725 which may need different target group
echo "=== BETAFPVH725 target.mk ==="
cat src/main/target/BETAFPVH725/target.mk
echo ""
echo "=== BETAFPVH725 target.h MCU/flash ==="
grep -E 'FC_TARGET_MCU|USE_FLASH|FLASH_CS|FLASH_SPI|MCU' src/main/target/BETAFPVH725/target.h
echo ""
echo "=== BF config BETAFPVH725 ==="
gh api repos/betaflight/config/contents/configs/BETAFPVH725/config.h --jq '.content' 2>/dev/null | base64 -d | grep -E 'MCU|FLASH|SPI|CS_PIN' | head -25
echo ""
echo "=== H725/H7 target group in makefile (grep for H725) ==="
grep -rn 'H725_TARGETS\|STM32H725\|h725' src/main/target/ --include='*.mk' | head -20Length of output: 2470 🏁 Script executed: #!/bin/bash
# Verify STELLARH7V2 FLASH_CS_PIN and HDZERO_HALO FLASH_CS_PIN/SPI_INSTANCE
echo "=== STELLARH7V2 target.h flash section ==="
grep -n 'FLASH_CS\|FLASH_SPI\|USE_FLASH' src/main/target/STELLARH7V2/target.h
echo ""
echo "=== HDZERO_HALO target.h flash section ==="
grep -n 'FLASH_CS\|FLASH_SPI\|USE_FLASH' src/main/target/HDZERO_HALO/target.h
echo ""
echo "=== MAMBAH743 USE_FLASH_M25P16 duplicate check ==="
grep -n 'USE_FLASH_M25P16\|USE_FLASH' src/main/target/MAMBAH743/target.h
echo ""
echo "=== ZEX_ATHENA_MINI FLASH_CS/SPI ==="
grep -n 'FLASH_CS\|FLASH_SPI\|USE_FLASH' src/main/target/ZEX_ATHENA_MINI/target.h
echo ""
echo "=== ZEX_ATHENA_STD_PRO FLASH_CS/SPI ==="
grep -n 'FLASH_CS\|FLASH_SPI\|USE_FLASH' src/main/target/ZEX_ATHENA_STD_PRO/target.h
echo ""
echo "=== WPLV2 FLASH_CS/SPI ==="
grep -n 'FLASH_CS\|FLASH_SPI\|USE_FLASH' src/main/target/WPLV2/target.hLength of output: 2586 🏁 Script executed: #!/bin/bash
# Check ALIENFLIGHTNGF7 full flash section including MAX7456 CS pin conflict check
echo "=== ALIENFLIGHTNGF7 target.h full flash+MAX7456 section ==="
grep -n 'FLASH\|MAX7456\|CS_PIN' src/main/target/ALIENFLIGHTNGF7/target.h
echo ""
echo "=== BF ALIENFLIGHTNGF7 full config ==="
gh api repos/betaflight/config/contents/configs/ALIENFLIGHTNGF7/config.h --jq '.content' 2>/dev/null | base64 -d | head -60Length of output: 3006 🏁 Script executed: #!/bin/bash
# Spot check a few more H7 new targets that weren't covered: KAKUTEH7, KAKUTEH7MINI, JHEH743_AIO, BETAFPVH743
for t in KAKUTEH7 KAKUTEH7MINI JHEH743_AIO BETAFPVH743 HGLRC_H743_LITE; do
echo "===== $t/target.h flash =====";
grep -E 'FLASH|SDCARD|SPI_INSTANCE|CS_PIN' src/main/target/$t/target.h | head -15
echo "--- BF config ---"
gh api repos/betaflight/config/contents/configs/$t/config.h --jq '.content' 2>/dev/null | base64 -d | grep -E 'FLASH|SDCARD|SPI_INSTANCE|CS_PIN' | head -10
echo
doneLength of output: 5145
Overall Result: ✅ Largely correct — 3 actionable issues, 1 concern, 1 noteThe vast majority of defines are faithful to BF config (chip IDs, 🔴 Issue 1 —
|
| Target | Chip | CS Pin | SPI | Status |
|---|---|---|---|---|
| KAKUTEH7V2 | W25N01G | PA4 | SPI1 | ✅ |
| KAKUTEH7MINI | W25N01G + W25Q128FV | PA4 | SPI1 | ✅ |
| MAMBAH743 | M25P16 + W25N01G | PA15 | SPI3 | ✅ |
| FOXEERH743 | W25Q128FV | PA15 | SPI3 | ✅ |
| DARWINH7DUAL | W25N01G + W25N02K | PD3 | SPI3 | ✅ |
| BETAFPVH725 | M25P16 | PB6 | SPI3 | ✅ |
| BETAFPVH743 | M25P16 | PB12 | SPI2 | ✅ |
| STELLARH7V2 | M25P16 + W25M02G | PE11 | SPI4 | ✅ |
| HDZERO_HALO | W25Q128FV | PB12 | SPI2 | ✅ |
| HGLRC_H743_LITE | W25Q128FV | PA15 | SPI3 | ✅ |
| JHEH743_AIO | M25P16 | PA15 | SPI3 | ✅ |
| JHEH743PRO | W25N01G + W25Q128FV | PA15 | SPI3 | ✅ |
| ZEX_ATHENA_MINI | W25Q128FV | PE2 | SPI3 | ✅ |
| ZEX_ATHENA_STD_PRO | W25Q128FV | PB12 | SPI2 | ✅ |
| WPLV2 | W25Q128FV | PB12 | SPI2 | ✅ |
| CLRACINGF7 | W25Q128FV + W25N01G | PB12 | SPI2 | ✅ |
| FPVM_BETAFLIGHTF7 | W25Q128FV | PE4 | SPI4 | ✅ |
| MATEKF722HD | W25Q128FV | PB12 | SPI2 | ✅ |
| ZEEZF7 | W25N01G | PA4 | SPI1 | ✅ |
| SPEEDYBEEF7V3 | M25P16 | PD2 | SPI3 | ✅ |
| OMNIBUSF4V6 | M25P16 | PB12 | SPI2 | ✅ |
| NEUTRONRCH743AIO / IFLIGHT_H7_TWING | (no CS in BF) | — | — | ✅ acknowledged |
| NBD_GALAXYAIO255 / MICOAIR743 / MICOAIR743V2 | none | — | — | ✅ |
| MATEKH743 | none (SDIO) | — | — | ✅ |
🧠 Learnings used
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-03-26T16:06:21.396Z
Learning: In the EmuFlight repository (emuflight/EmuFlight), the maintainer (nerdCopter) does not want follow-up GitHub issues created for GitHub Actions SHA pinning or cache key hardening suggestions. The preference is mutable version tags (e.g., v4, v5) and no issue tracking for this topic.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 1189
File: src/main/drivers/bus_spi.c:631-631
Timestamp: 2026-05-15T14:49:26.586Z
Learning: In EmuFlight (emuflight/EmuFlight), all STM32F303 targets in the master branch exceed hardware RAM budget (pre-existing overflow unrelated to any specific PR). As a result, F303 targets do not compile and any F303-specific driver fixes in shared files (e.g., bus_spi.c) should be deferred to a dedicated F3-targeted PR when/if the RAM overflow is resolved.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 1201
File: src/main/target/XILOF4/target.h:151-151
Timestamp: 2026-05-20T19:24:43.018Z
Learning: In the EmuFlight repository, XILOF4 is NOT an EF-only target — it has a matching BF 4.5-maintenance config at `config/configs/XILOF4/config.h` which specifies `DEFAULT_CURRENT_METER_SCALE 118`. The value change from 179 to 118 in `src/main/target/XILOF4/target.h` is intentional and sourced from that BF config.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-04-22T20:55:55.130Z
Learning: In the EmuFlight refactor series (emuflight/EmuFlight, PRs `#1111`, `#1114`, `#1116`, etc.), new-code findings are actionable only if Betaflight 4.5-maintenance does the equivalent. The distinguishing criterion for I2C vs SPI return-value checking: BF 4.5-m's `i2cBusSetInstance` callers do NOT check the return value (so adding a return-value guard in EmuFlight would diverge from BF), whereas BF 4.5-m's `spiSetBusInstance` callers DO check the return (making SPI-side return-check guards in-scope). Adding EF-only documentation or guards to BF-parity functions creates maintenance drift and is out of scope for this series.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-04-23T20:41:53.090Z
Learning: In EmuFlight PR `#1118` (Stage L.2), the correct merge order is: companion targets-only PR `#1119` (macro renames: *_SPI_INSTANCE → *_SPI_BUS across target.h files) must merge first, then `#1118` (call-site migration + forwarder removal in source files). CI failures for undeclared *_SPI_BUS macros in `#1118` standalone are a known merge-order artefact, not code bugs.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-05-07T16:05:33.483Z
Learning: When responding to nerdCopter on the EmuFlight repository, NEVER generate a coding plan or implementation steps unless the exact keyword "PLAN" appears in their message. Always answer questions directly and concisely.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-04-28T16:46:02.780Z
Learning: EmuFlight (emuflight/EmuFlight) does not maintain 80% docstring coverage codebase-wide. Any automated finding of "docstring coverage X% < 80%" is a pre-existing baseline condition and is out of scope for the BF-parity refactor series (PRs `#1111`, `#1114`, `#1116`, `#1118`, `#1121`, `#1128`, etc.). Do not flag docstring coverage deficiencies in EmuFlight refactor PRs.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-05-29T15:36:21.638Z
Learning: In `src/main/drivers/flash_w25n.c` (EmuFlight PR `#1204`), all code patterns that appear as potential issues are faithful backports of BF 4.5-maintenance. Specifically: (1) the BBLUT SPI callback `<< 16` shift (line ~1022) is a pre-existing BF bug tracked as EF `#1212` / BF `#15271`; (2) the QuadSPI BBLUT path reading from `in` instead of `bblutBuffer` (line ~1079) is the same BF bug; (3) the outer `#ifdef USE_QUADSPI` wrapping `w25n_programDataLoad`/`w25n_randomProgramDataLoad` is intentional since they are only called from the QuadSPI pageProgramContinue path; (4) `bufferDirty` and `isProgramming` being non-static matches BF 4.5-maintenance. Do not flag any of these as divergences from BF upstream.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-05-28T20:33:08.829Z
Learning: In EmuFlight, `TIM_USE_CAMERA_CONTROL` is not currently defined in `src/main/drivers/timer.h` even though Betaflight target configs may reference it. For EmuFlight target timer entries that are camera-control pins, use an existing timer usage such as `TIM_USE_ANY` and document the Betaflight camera-control mapping in a comment until EmuFlight adds a dedicated enum value.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-05-30T17:48:26.388Z
Learning: In EmuFlight (repository: emuflight/EmuFlight), the following bugs were present in the BF 4.5-maintenance flash driver backport but were intentionally fixed in EmuFlight in commit `9f424ae95d` (PR `#1225`), diverging from upstream BF. Do NOT flag these as "BF parity" items in future reviews — they are fixed in EmuFlight:
1. `m25p16_waitForReady` in `src/main/drivers/flash_m25p16.c`: now has a 500 ms timeout; the previous infinite `while (!m25p16_isReady(fdevice));` spin is gone.
2. `m25p16Qspi_vTable` in `src/main/drivers/flash_m25p16.c`: now includes `.configure`; the previous NULL pointer omission is fixed.
3. `w25m_pageProgramBegin` in `src/main/drivers/flash_w25m.c`: now correctly passes `currentWriteAddress` (die-relative) instead of the raw `address` parameter.
4. BBLUT SPI callback in `src/main/drivers/flash_w25n.c`: shift changed from `<< 16` to `<< 8` for both `pba` and `lba` (was tracked as EF issue `#1212` / upstream BF#15271).
5. `w25q128fv_pageProgramContinue` in `src/main/drivers/flash_w25q128fv.c`: now accumulates `bytesWritten`, sets `callbackArg`, and invokes callback in `pageProgramFinish`; the prior uninitialized return is fixed.
The only remaining intentional BF-parity divergences (still present in EmuFlight) are: duplicate `couldBeBusy = true` at lines 231–232 in `flash_m25p16.c`, and the `flashPartitionSet` off-by-one guard (`== FLASH_MAX_PARTITIONS - 1`) in `flash.c`.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-04-24T19:48:08.632Z
Learning: In EmuFlight bus_spi_impl.h (Stage M, PR `#1121`), the header intentionally has no self-contained includes and relies on includer-ordering, because BF 4.5-maintenance bus_spi_impl.h lines 87-92 are identical in structure (same function stubs, no includes, same reliance). This is a pre-existing upstream pattern and should not be flagged as a deficiency in EmuFlight refactor PRs. The issue was filed as EmuFlight `#1122` for upstream tracking.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-05-28T19:13:36.183Z
Learning: For EmuFlight PR `#1194` STM32H7 support, NAND erase blocking interactions with USB MSC are intentionally tracked under the separate `h7-flash-mashup` scope and should not be treated as blockers for the core STM32H7 port.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-05-29T16:42:07.214Z
Learning: In EmuFlight H7 target configuration, `USE_FLASH` may be redundant when flash chip macros trigger the cascade in `src/main/target/common_fc_post.h`; for example, `USE_FLASH_W25N01G` implies `USE_FLASH_W25N`, which implies `USE_FLASH`. Do not flag removal of an explicit `USE_FLASH` define when this cascade already applies.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-05-30T16:48:32.440Z
Learning: In EmuFlight (repository: emuflight/EmuFlight), the flash driver stack in `src/main/drivers/flash_m25p16.c`, `src/main/drivers/flash_w25m.c`, `src/main/drivers/flash_w25n.c`, `src/main/drivers/flash_w25q128fv.c`, and `src/main/drivers/flash.c` was backported from Betaflight 4.5-maintenance (PR `#1225`). The following patterns are intentional BF 4.5-m parity items and should NOT be flagged as bugs:
1. `m25p16_waitForReady` spins with `while (!m25p16_isReady(fdevice));` — no timeout, identical to BF.
2. Duplicate `couldBeBusy = true` assignments at lines 231–232 in `flash_m25p16.c` — identical to BF, both lines intentional.
3. `m25p16Qspi_vTable` (QSPI vtable) is missing `.configure` — identical omission in BF.
4. `w25m_pageProgramBegin` passes the full `address` parameter rather than `currentWriteAddress` — identical to BF at line 207 of `flash_w25m.c`.
5. BBLUT `<< 16` shift overflow in `flash_w25n.c` lines 1015–1016 — pre-existing BF bug filed as BF#15271, tracked in EF as issue `#1212`.
6. `w25q128fv_pageProgramContinue` returns `fdevice->callbackArg` — identical to BF at line 430 of `flash_w25q128fv.c`.
7. `flashPartitionSet` off-by-one guard (`== FLASH_MAX_PARTITIONS - 1`) — identical to BF at line 585 of `flash.c`.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 1225
File: src/main/target/common_fc_post.h:209-223
Timestamp: 2026-05-30T19:05:58.951Z
Learning: In `src/main/target/common_fc_post.h` (EmuFlight), the flash macro normalization block (USE_FLASH_CHIP, USE_FLASH_TOOLS, USE_FLASHFS auto-enable/rollback) is placed *after* the `USE_USB_MSC` pruning check at line ~153. This ordering is intentional BF 4.5-maintenance parity (identical to upstream Betaflight 4.5-maintenance source). Do not flag the interaction between the flash normalization block and the earlier USB_MSC pruning as a bug.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 0
File: :0-0
Timestamp: 2026-05-30T17:59:21.173Z
Learning: In EmuFlight (repository: emuflight/EmuFlight), the `flashPartitionSet` off-by-one guard (`flashPartitions == FLASH_MAX_PARTITIONS - 1` instead of `>=`) in `src/main/drivers/flash.c` is a known BF 4.5-maintenance parity item intentionally retained for PR `#1225`. It is tracked in EmuFlight as issue `#1226` (referencing upstream BF#15279) for post-merge resolution. Do NOT flag it as a new bug during review of this PR — it has zero runtime impact with current single-partition usage and is acknowledged by maintainers.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 1204
File: src/main/drivers/flash_w25n.c:1020-1022
Timestamp: 2026-05-28T20:30:50.733Z
Learning: In `src/main/drivers/flash_w25n.c` (EmuFlight), the `w25n_readBBLUTCallback` function uses `<< 16` shifts when assembling `pba` and `lba` from `rxData` (e.g., `cb_context->bblut->pba = (rxData[0] << 16)|rxData[1]`). This is a known pre-existing Betaflight upstream bug (BF `#15271`) carried in at BF 4.5-maintenance parity. The SPI BBLUT path is dead on all current EmuFlight W25N targets (no NAND flash in production). The fix is deferred to EF issue `#1212` and will be addressed when a W25N + QuadSPI EF target exists. Do not flag this in reviews.
Learnt from: nerdCopter
Repo: emuflight/EmuFlight PR: 1225
File: src/main/drivers/flash_w25n.h:23-25
Timestamp: 2026-05-30T19:05:48.233Z
Learning: In EmuFlight (repository: emuflight/EmuFlight), `src/main/drivers/flash_w25n.h` intentionally omits forward `#include` directives for `<stdbool.h>`, `<stdint.h>`, and `flash_impl.h`. This matches the BF 4.5-maintenance upstream source verbatim and is kept for parity. Do not flag the missing includes as an issue in future reviews.
FOXEERH743: remove spurious SDCARD from FEATURES — BF config has no SDCARD hardware (//TODO #define SDCARD_MODE OFF); generator artifact. KAKUTEH7, GEPRC_TAKER_H743: remove USE_SDCARD_SDIO — BF configs specify USE_SDCARD_SPI only; SDIO define conflicts with the SPI CS/instance pins already present in both files. Found by CodeRabbit review of PR emuflight#1233.
|
AI Generated comment @coderabbitai, thank you for the thorough cross-reference analysis. Issue 1 — FOXEERH743 spurious SDCARD in FEATURES: Fixed. BF config confirms Issue 2 — KAKUTEH7 / GEPRC_TAKER_H743 USE_SDCARD_SDIO conflict: Fixed. Both BF configs specify Issue 3 — ALIENFLIGHTNGF7 FLASH_CS_PIN and MAX7456_SPI_CS_PIN both PB12: Verified against BF config — BF config has the same assignment for both pins. This is a pre-existing hardware design in the BF source of truth, not an EF divergence. No change made. ✅ (BF parity) Note 1 — MAMBAH743 duplicate USE_FLASH_M25P16: Harmless preprocessor duplicate — same flag defined twice is a no-op. Cosmetic only, no change. Note 2 — BETAFPVH725 H723_TARGETS for STM32H725: Consistent with EF's H7 build system; H725 shares H723 silicon family. No change needed. All fixes committed in |
|
Tip For best results, initiate chat on the files or code changes.
Recording the ALIENFLIGHTNGF7 pin-share as a learning to avoid re-raising it. (´。• ᵕ •。`) ♡ ✏️ Learnings added
🧠 Learnings used |
Two identical defines existed: bare at line 37 and commented at line 44. Removed the bare one; retained the annotated form with the driver comment '// 16MB Micron M25P16 driver; drives all unless QSPI' for clarity.
|
@coderabbitai, approve if you truly approve |
|
(ノ◕ヮ◕)ノ*:・゚✧ 🧠 Learnings used✅ Action performedComments resolved and changes approved. |
AI Generated pull-request
Summary
feat/stm32h7-supportbranch backup (KAKUTEH7*, MAMBAH743*, MATEKH743, FOXEERH743*, GEPRC_TAKER_H743*, IFLIGHT_H743_AIO*, JHEH743*, DARWINH7DUAL, and 55 others). Each hastarget.ctimer pin maps,USED_TIMERS, and flash defines sourced from the stm32h7-support branch.USE_FLASH_W25M02G— previously disabled pending feat(h7/nand): non-blocking W25N NAND erase state machine for STELLARH7DEV #1209; fixed in fix(flash/nand): NAND flash fixes; re-enable W25M02G on STELLARH7DEV #1231.config/configs/) across all 378 targets:USE_FLASH_W25Q128FValongsideUSE_FLASH_M25P16(chip identifier, BF 4.5 parity)USE_FLASH_W25M; upgrade toUSE_FLASH_W25Q128FVONBOARDFLASH/chip-define mismatches (SPEEDYBEEF7V3, PYRODRONEF4PDB, VRRACE, OMNIBUSF4V6)ONBOARDFLASHin .mk but no defines in .h)ONBOARDFLASH(no flash hardware per BF configs — converter default noise)Test plan